home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
PET
/
S-Super PET
/
(s)tk.d64
/
UDUMP.ASM
< prev
next >
Wrap
Assembly Source File
|
2009-01-18
|
6KB
|
156 lines
; u.asm - A universal dump to disk, printer, serial, or ieee4. No LF with CR.
; Gary L. Ratliff's screen dump routine, using Jeff Larson's print routine,
; as modified by Terry M. Peterson, and modified some more by Gary Ratliff,
; to also work as a screen-disk dump, and as modified some more by Dick Barnes
; to be a universal dump to disk, ieee4, printer, or serial. Then modified by
; Delton P. Richardson to print reverse field char. as normal characters on
; dot-matrix printers. There's a lot of blood on this one....
; To use : Press shifted-7 key on keypad (PF 7), then touch:
; i for dump to IEEE4
; p for dump to PRINTER No RETURN is required. The character is 'got'.
; d for dump to DISK Any wrong key causes default to PRINTER
; s for dump to SERIAL
; Action : Prints CRT from line 1 THROUGH line cursor is on at start.
; Be SURE to put a file named: file%n on drive 0 for dumps to disk; all material
; is appended to that file.
xref curpos_, memend_, conbint_, printf_, openf_, kyputb_
xref closef_, fputchar_, fputnl_, initstd_, intvctr_, kyindx_, kyptr1_
xref kyptr2_, file_, usirq_, printer_, serial_, write_, append_
main equ *
jsr initstd_ ; Crash at monitor breakpoints if this is left out.
ldd #main
std memend_
clr $32 ; Service_ at $32 set zero returns to menu.
clr busy
ldd #instr ; Give the instructions on how to use this at
jsr printf_ ; loading; thereafter, no prompts.
ldx #8
ldd intvctr_,x
std resvd
pshs x
ldd #start
jsr conbint_
puls d
rts
start equ *
jsr [resvd]
ldb kyindx_
cmpb #$95 ; Shift keypad 7 with offset.
lbne done ; Quit if it isn't down.
tst busy
if eq
dec busy
ldd #margin ; Cursor set to left margin to avoid printing
jsr printf_ ; next line.
ldd curpos_
addd #80 ; Adjust cursor value to print line cursor
std where ; is on--including line 25.
ldd kyptr2_
std kyptr1_
bsr getit ; Go get the input on type dump wanted.
ldb #'d ; Dump to disk?
guess
cmpb type
quif ne
ldd #append_ ; Yeah, dump to disk, so open for append.
pshs d
ldd #file_
admit
ldd #write_ ; Get write mode for all other options.
pshs d ; If you don't want this program to default
ldb #'i ; to a Commodore printer, change the
cmpb type ; ldb characters from here on, and let the
quif ne ; dump default to the one you don't list.
ldd #ieee
admit
ldb #'s ; s is serial, i is ieee4, p is Commodore;
cmpb type ; since p isn't listed, that is default.
quif ne ; If any wrong character is entered, you still
ldd #serial_ ; get default to 'printer'
admit
ldd #printer_
endguess
jsr openf_
std outpt ; Store file control block returned by openf_
puls d ; Recover from 'write'/'append' push.
if ne
ldx #1 ; Start with screen position 1.
loop
ldb kyindx_
cmpb #4
quif eq
pshs x
bsr print ; Go print line.
puls x
leax 80,x ; Increment x by 80 char for one line.
cmpx where ; Compare x to where cursor was at start.
until hs ; If 'higher' or 'same', quit loop.
ldd outpt ; Load file control block,
jsr closef_ ; and close the file.
endif
clr busy
endif
ldy #$130 ; Start of keyboard buffer.
loop ; Characters w/out CR 'leak' to screen...and enter
clr ,y+ ; false monitor cmds, so clear buffer to the
cmpy #$158 ; end, at $157.
until eq
done rts
margin fcb 11,13,0 ; Sets cursor to left margin.
where rmb 2 ; Stores original cursor position + 80
getit loop
jsr kyputb_ ; Get response--no RETURN.
cmpb #0 ; Look for more than null.
until ne
stb type
cmpb #$7b ; PF7 will kick off dump to 'printer' if hit again.
if pl ; So refuse any character larger than 'z';
jmp getit ; jump back for valid character.
endif
rts
print lda #79
leax $7fff,x ; $8000 is start of screen (x has 1 in it
loop ; at the start).
ldb a,x ; Start with a=79 + x=$8000, or end line.
cmpb #' ; and compare that position with a null.
quif ne ; If a char, stop; if null, keep going.
deca ; And keep looking until you find a character....
until mi ; until the minus report by neg flag (no char at all)
cmpb #' ; Need comparison for next line--
if ne ; If NOT zero (may be negative for reverse field),
loop
ldb ,x+ ; Back up and get character.
cmpb #$a0 ; Check for reverse field.
blo norm ; If value lower than dec 160, branch to reg. char.
subb #$80 ; If not, convert to normal char.
norm pshs d,x ; Save registers--
ldd outpt ; get the file control block
jsr fputchar_ ; and print the character
puls d,x
deca ; decrement by one character, which we printed
until mi ; and keep printing until DEC reports line done.
endif
ldd outpt ; Get the file control block,
jmp fputnl_ ; and put new line to file.
outpt rmb 2
resvd rmb 2
busy rmb 2
type rmb 1
ieee fcc "ieee4"
fcb 0
instr fcb 12
fcc "UDUMP loaded. To use: press PF7, then one of keys below.%n%n"
fcc "To disk: 'd'| to ieee4: 'i'| to printer: 'p'| to serial: 's'%n%n"
fcb 0
end